#
# Convert a Professor Greenstadt file to binary
#
# @author Jonathan Walsh
#

import os,sys
import array

if len(sys.argv) != 3:
    print "USAGE: write_as_binary.py <in> <out>"
    sys.exit(1)

arr= array.array('B')
for line in open(sys.argv[1]):
    l = line.strip()
    i = int(l,16)
    arr.append(i)
    print l + " - " + str(i)
    
fout=open(sys.argv[2],"w")
arr.tofile(fout)
fout.close()
